﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PJ.Data.Inventory;
using PJ.Framework.Common;
using PJ.Data;

namespace PJ.Business.Inventory
{
    /// <summary>
    /// InventoryItemBarCodeService class
    /// </summary>
    public class InventoryBarCodeService : EntityService<IInventoryBarCode, IInventoryBarCodeData, IInventoryBarCodeProvider>, IInventoryBarCodeService
    {
        #region Constructor

        public InventoryBarCodeService(IInventoryBarCodeProvider dataService)
            : base(dataService)
        {
        }
        #endregion

        
        #region Interface implementation

        public IInventoryItemService InventoryItemService
        {
            get
            {
                if (_InventoryItemService == null)
                    _InventoryItemService = InjectionBroker.Resolve<IInventoryItemService>();
                return _InventoryItemService;
            }
        }

        public string[] GetFragments(string parentId, GetDataMode mode)
        {
            return DataService.GetFragments(parentId, mode);
        }
        #endregion

        #region Interface override

        public IEntityService OwnerService
        {
            get { return InventoryItemService; }
        }

        #endregion

        #region Public

        public override IInventoryBarCode CreateNewItem()
        {
            return new InventoryBarCode(DataService.CreateNewItem());
        }
        #endregion

        #region Field
        private IInventoryItemService _InventoryItemService;

        #endregion


    }
}
